﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace School.Pages.Bus
{
    public partial class Rpt_Route_bus : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((IQueryable<int>)Session["privilage"] != null)
            {
                var x = (IQueryable<int>)Session["privilage"];

                if (x.Contains(1210) == true)
                {
                    if (!IsPostBack)
                        ddlBind(ddCamp1, School.Service.Bus.GetAllCampuses().ToList());
                }
                else
                    Response.Redirect("../organization/no_privelege.aspx");
            }
            else
                Response.Redirect("../organization/no_privelege.aspx");
        }
        private void ddlBind(DropDownList ddl, object o)
        {
            ddl.DataSource = o;
            ddl.Items.Clear();
            ddl.Items.Insert(0, new ListItem("-- أختيار --", "-1"));
            ddl.DataBind();
        }

        protected void ddlbus_SelectedIndexChanged(object sender, EventArgs e)
        {
            rv_Route.LocalReport.Refresh();
        }

        protected void ddCamp1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ddlbus.Items.Clear();
            ddlbus.Items.Insert(0, new ListItem("-- أختيار --", "-1"));
            rv_Route.LocalReport.Refresh();
        }
    }
}